+Mon Oct 22 11:47:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklabel.c: Add cursor-position, selection-bound
+ properties. (#62148, Reported by Padraig O'briain)
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Rename text_position
+ to cursor_position. (1.3.x addition, text_position is an awful
+ name.) Make cursor_position read-only to avoid sticky questions
+ of interaction with selection_bound.
+
Mon Oct 22 16:25:12 2001 Owen Taylor <otaylor@redhat.com>
Fixing popup menus to have "Paste" sensitized correctly. Original
2001-06-04 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
- releases for buttons 6, 7
+r eleases for buttons 6, 7
2001-06-04 Havoc Pennington <hp@redhat.com>
+Mon Oct 22 11:47:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklabel.c: Add cursor-position, selection-bound
+ properties. (#62148, Reported by Padraig O'briain)
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Rename text_position
+ to cursor_position. (1.3.x addition, text_position is an awful
+ name.) Make cursor_position read-only to avoid sticky questions
+ of interaction with selection_bound.
+
Mon Oct 22 16:25:12 2001 Owen Taylor <otaylor@redhat.com>
Fixing popup menus to have "Paste" sensitized correctly. Original
2001-06-04 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
- releases for buttons 6, 7
+r eleases for buttons 6, 7
2001-06-04 Havoc Pennington <hp@redhat.com>
+Mon Oct 22 11:47:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklabel.c: Add cursor-position, selection-bound
+ properties. (#62148, Reported by Padraig O'briain)
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Rename text_position
+ to cursor_position. (1.3.x addition, text_position is an awful
+ name.) Make cursor_position read-only to avoid sticky questions
+ of interaction with selection_bound.
+
Mon Oct 22 16:25:12 2001 Owen Taylor <otaylor@redhat.com>
Fixing popup menus to have "Paste" sensitized correctly. Original
2001-06-04 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
- releases for buttons 6, 7
+r eleases for buttons 6, 7
2001-06-04 Havoc Pennington <hp@redhat.com>
+Mon Oct 22 11:47:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklabel.c: Add cursor-position, selection-bound
+ properties. (#62148, Reported by Padraig O'briain)
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Rename text_position
+ to cursor_position. (1.3.x addition, text_position is an awful
+ name.) Make cursor_position read-only to avoid sticky questions
+ of interaction with selection_bound.
+
Mon Oct 22 16:25:12 2001 Owen Taylor <otaylor@redhat.com>
Fixing popup menus to have "Paste" sensitized correctly. Original
2001-06-04 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
- releases for buttons 6, 7
+r eleases for buttons 6, 7
2001-06-04 Havoc Pennington <hp@redhat.com>
+Mon Oct 22 11:47:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklabel.c: Add cursor-position, selection-bound
+ properties. (#62148, Reported by Padraig O'briain)
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Rename text_position
+ to cursor_position. (1.3.x addition, text_position is an awful
+ name.) Make cursor_position read-only to avoid sticky questions
+ of interaction with selection_bound.
+
Mon Oct 22 16:25:12 2001 Owen Taylor <otaylor@redhat.com>
Fixing popup menus to have "Paste" sensitized correctly. Original
2001-06-04 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
- releases for buttons 6, 7
+r eleases for buttons 6, 7
2001-06-04 Havoc Pennington <hp@redhat.com>
+Mon Oct 22 11:47:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklabel.c: Add cursor-position, selection-bound
+ properties. (#62148, Reported by Padraig O'briain)
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Rename text_position
+ to cursor_position. (1.3.x addition, text_position is an awful
+ name.) Make cursor_position read-only to avoid sticky questions
+ of interaction with selection_bound.
+
Mon Oct 22 16:25:12 2001 Owen Taylor <otaylor@redhat.com>
Fixing popup menus to have "Paste" sensitized correctly. Original
2001-06-04 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
- releases for buttons 6, 7
+r eleases for buttons 6, 7
2001-06-04 Havoc Pennington <hp@redhat.com>
+Mon Oct 22 11:47:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklabel.c: Add cursor-position, selection-bound
+ properties. (#62148, Reported by Padraig O'briain)
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Rename text_position
+ to cursor_position. (1.3.x addition, text_position is an awful
+ name.) Make cursor_position read-only to avoid sticky questions
+ of interaction with selection_bound.
+
Mon Oct 22 16:25:12 2001 Owen Taylor <otaylor@redhat.com>
Fixing popup menus to have "Paste" sensitized correctly. Original
2001-06-04 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
- releases for buttons 6, 7
+r eleases for buttons 6, 7
2001-06-04 Havoc Pennington <hp@redhat.com>
enum {
PROP_0,
- PROP_TEXT_POSITION,
+ PROP_CURSOR_POSITION,
+ PROP_SELECTION_BOUND,
PROP_EDITABLE,
PROP_MAX_LENGTH,
PROP_VISIBILITY,
class->activate = gtk_entry_real_activate;
g_object_class_install_property (gobject_class,
- PROP_TEXT_POSITION,
- g_param_spec_int ("text_position",
- _("Text Position"),
- _("The current position of the insertion point"),
+ PROP_CURSOR_POSITION,
+ g_param_spec_int ("cursor_position",
+ _("Cursor Position"),
+ _("The current position of the insertion cursor in chars."),
0,
G_MAXINT,
0,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_SELECTION_BOUND,
+ g_param_spec_int ("selection_bound",
+ _("Selection Bound"),
+ _("The position of the opposite end of the selection from the cursor in chars."),
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_EDITABLE,
switch (prop_id)
{
- case PROP_TEXT_POSITION:
- gtk_editable_set_position (GTK_EDITABLE (object),
- g_value_get_int (value));
- break;
-
case PROP_EDITABLE:
{
gboolean new_value = g_value_get_boolean (value);
break;
case PROP_SCROLL_OFFSET:
+ case PROP_CURSOR_POSITION:
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
switch (prop_id)
{
- case PROP_TEXT_POSITION:
+ case PROP_CURSOR_POSITION:
g_value_set_int (value, entry->current_pos);
break;
+ case PROP_SELECTION_BOUND:
+ g_value_set_int (value, entry->selection_bound);
+ break;
case PROP_EDITABLE:
g_value_set_boolean (value, entry->editable);
break;
gint selection_bound)
{
gboolean changed = FALSE;
+
+ g_object_freeze_notify (G_OBJECT (entry));
if (current_pos != -1 &&
entry->current_pos != current_pos)
entry->current_pos = current_pos;
changed = TRUE;
- g_object_notify (G_OBJECT (entry), "text_position");
+ g_object_notify (G_OBJECT (entry), "cursor_position");
}
if (selection_bound != -1 &&
{
entry->selection_bound = selection_bound;
changed = TRUE;
+
+ g_object_notify (G_OBJECT (entry), "selection_bound");
}
+ g_object_thaw_notify (G_OBJECT (entry));
+
if (changed)
gtk_entry_recompute (entry);
}
PROP_WRAP,
PROP_SELECTABLE,
PROP_MNEMONIC_KEYVAL,
- PROP_MNEMONIC_WIDGET
+ PROP_MNEMONIC_WIDGET,
+ PROP_CURSOR_POSITION,
+ PROP_SELECTION_BOUND
};
static guint signals[LAST_SIGNAL] = { 0 };
GTK_TYPE_WIDGET,
G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_CURSOR_POSITION,
+ g_param_spec_int ("cursor_position",
+ _("Cursor Position"),
+ _("The current position of the insertion cursor in chars."),
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_SELECTION_BOUND,
+ g_param_spec_int ("selection_bound",
+ _("Selection Bound"),
+ _("The position of the opposite end of the selection from the cursor in chars."),
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READABLE));
+
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("cursor_color",
_("Cursor color"),
case PROP_MNEMONIC_WIDGET:
g_value_set_object (value, (GObject*) label->mnemonic_widget);
break;
+ case PROP_CURSOR_POSITION:
+ if (label->select_info)
+ {
+ gint offset = g_utf8_pointer_to_offset (label->label,
+ label->label + label->select_info->selection_end);
+ g_value_set_int (value, offset);
+ }
+ else
+ g_value_set_int (value, 0);
+ break;
+ case PROP_SELECTION_BOUND:
+ if (label->select_info)
+ {
+ gint offset = g_utf8_pointer_to_offset (label->label,
+ label->label + label->select_info->selection_anchor);
+ g_value_set_int (value, offset);
+ }
+ else
+ g_value_set_int (value, 0);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
min = MIN (min, index);
max = MAX (max, index);
- gtk_label_select_region_index (label,
- min,
- max);
-
/* ensure the anchor is opposite index */
- if (index == label->select_info->selection_anchor)
+ if (index == min)
{
- gint tmp = label->select_info->selection_end;
- label->select_info->selection_end = label->select_info->selection_anchor;
- label->select_info->selection_anchor = tmp;
+ gint tmp = min;
+ min = max;
+ max = tmp;
}
+
+ gtk_label_select_region_index (label, min, max);
}
else
{
}
if (setting != old_setting)
{
- g_object_notify (G_OBJECT (label), "selectable");
- gtk_widget_queue_draw (GTK_WIDGET (label));
+ g_object_freeze_notify (G_OBJECT (label));
+ g_object_notify (G_OBJECT (label), "selectable");
+ g_object_notify (G_OBJECT (label), "cursor_position");
+ g_object_notify (G_OBJECT (label), "selection_bound");
+ g_object_thaw_notify (G_OBJECT (label));
+ gtk_widget_queue_draw (GTK_WIDGET (label));
}
}
gtk_label_clear_layout (label);
gtk_widget_queue_draw (GTK_WIDGET (label));
+
+ g_object_freeze_notify (G_OBJECT (label));
+ g_object_notify (G_OBJECT (label), "cursor_position");
+ g_object_notify (G_OBJECT (label), "selection_bound");
+ g_object_thaw_notify (G_OBJECT (label));
}
}